cmake_minimum_required(VERSION 3.21)

# Configure by yourself
project(Snake-Game VERSION "0.1.0")
set(BINARY_NAME snake)

# Your config.cmake should contain at least the following properties:
set(PROJECT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_CXX_STANDARD 23)
#set(CMAKE_PREFIX_PATH "your/cmake/prefix/path")
set(QT_VERSION 6)

# Target directory
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}/bin")
set(LIBRARY_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}/bin")

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

# Required Qt Libraries
set(REQUIRED_LIBS Core Gui Widgets Network WebSockets)
set(REQUIRED_LIBS_QUALIFIED Qt${QT_VERSION}::Core Qt${QT_VERSION}::Gui Qt${QT_VERSION}::Widgets Qt${QT_VERSION}::Network Qt${QT_VERSION}::WebSockets)

# Find package
find_package(Qt${QT_VERSION} COMPONENTS ${REQUIRED_LIBS} REQUIRED)

# Project sources
set(PROJECT_SOURCES snake-game.qrc
        main.cpp mainwindow.cpp mainwindow.h mainwindow.ui
        player.cpp player.h
        room.cpp room.h
        message.cpp message.h
        messageutil.cpp messageutil.h
        snakegame.cpp snakegame.h)

if (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
    set(PROJECT_SOURCES WIN32 ${PROJECT_SOURCES})
endif()

add_executable(${BINARY_NAME} ${PROJECT_SOURCES})
target_link_libraries(${BINARY_NAME} ${REQUIRED_LIBS_QUALIFIED})
